#include "functionselect.h"
#include "ui_functionselect.h"
#include "group.h"
#include "usermanager.h"
#include "battlegroup.h"
#include "aboutmepage.h"
#include "datamanager.h"
#include "dialog/myhelper.h"
#include "constant.h"


FunctionSelect::FunctionSelect(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FunctionSelect)
{
    ui->setupUi(this);

    if(Constant::ShowFullScreen)
        this->showFullScreen();
}

FunctionSelect::~FunctionSelect()
{
    delete ui;

}

void FunctionSelect::on_functionsel_group_bt_clicked()
{
    Group *group=new Group();
    connect(this,SIGNAL(sendType(int)),group,SLOT(getType(int)));
    emit sendType(0);
    group->show();

}
void FunctionSelect::paintEvent(QPaintEvent *event)
{
    //通过这种方式可以将图片平铺到窗口上
    //使用样式表可以很方便设置界面，而且非常高效，还能让界面和逻辑分离
    //不过在本例中由于是顶层窗口，所以直接设置样式表也不会显示。
    //所以样式表比较适合子窗口来使用。
    QPainter painter(this);
    painter.drawPixmap(rect(),QPixmap(":/images/share/selectmodel_page_bg2.png"),QRect());
}



void FunctionSelect::on_functionsel_UserManager_bt_clicked()
{
    UserManager *usermanager=new UserManager();
    usermanager->show();
}

void FunctionSelect::on_functionsel_battle_bt_clicked()
{
//    BattleGroup *battlegroup=new BattleGroup();
//    battlegroup->show();
    Group *group=new Group();
    connect(this,SIGNAL(sendType(int)),group,SLOT(getType(int)));
    emit sendType(1);
    group->show();

}

void FunctionSelect::on_functionsel_aboutme_bt_clicked()
{
    AboutMePage *aboutMePage=new AboutMePage;
    aboutMePage->show();
}


void FunctionSelect::on_functionsel_DataManager_bt_clicked()
{
    DataManager *dataManager=new DataManager;
    dataManager->show();

}


void FunctionSelect::on_login_exit_bt_clicked()
{
    if(myHelper::ShowMessageBoxQuesion("您确定要关闭软件吗？"))
        this->close();
}

